package cn.edu.scau.cmi.pengjiajian.client;


import org.springframework.context.ApplicationContext;
import cn.edu.scau.cmi.panbaoyu.spring.domain.Student;
import cn.edu.scau.cmi.panbaoyu.spring.util.ApplicationContextUtil;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;

public class SpringClient extends Application{
	static Student student = null;
	
	protected VBox getPane() {
		VBox pane = new VBox();
		pane.setPadding(new Insets(50,50,50,50));  
		Label labshow = new Label();
		labshow.setText(student.getName() + "的教师是" + student.getTutor().getName());
		labshow.setAlignment(Pos.TOP_CENTER);
		labshow.setFont(new Font("Arial",20));
		pane.getChildren().addAll(labshow);
		return pane;
	}
	
	
	public void start(Stage primaryStage) {
		
		Scene scene = new Scene(getPane());
		primaryStage.setTitle("实验八-Spring的基本使用");
		primaryStage.setScene(scene);
		primaryStage.show();
	}
	
	public static void main(String[] args) {
		// TODO 自动生成的方法存根
		ApplicationContext applicationContext = ApplicationContextUtil.getApplicationContext();
		student= (Student) applicationContext.getBean("panbaoyu");
		Application.launch(args);
	}

}
